//
//  BusineseLicenceTableViewCell.m
//  PropertyManager
//
//  Created by 楠 on 2018/10/21.
//  Copyright © 2018年 Tng. All rights reserved.
//

#import "BusineseLicenceTableViewCell.h"

@implementation BusineseLicenceTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self creatUI];
        self.backgroundColor = SFM242;
    }
    return self;
}

-(void)creatUI{
    [self.contentView addSubview:self.bgView];
    [self.bgView addSubview:self.nameLabel];
    [self.bgView addSubview:self.numLabel];
    [self.bgView addSubview:self.dateLabel];
    [self.bgView addSubview:self.timeLabel];
}

-(UIView *)bgView
{
    if (_bgView == nil) {
        _bgView =[[UIView alloc] initWithFrame:CGRectMake(10, 0, WIDTH - 20, 115)];
        _bgView.backgroundColor = SFMWhiteColor;
        _bgView.layer.cornerRadius = 4;
        _bgView.clipsToBounds = YES;
    }
    return _bgView;
}

-(UILabel *)nameLabel
{
    if (_nameLabel == nil) {
        _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, WIDTH - 40, 20)];
        _nameLabel.font = font(14);
        _nameLabel.textColor = SFM51;
        _nameLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _nameLabel;
}

-(UILabel *)numLabel
{
    if (_numLabel == nil) {
        _numLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 35, WIDTH - 40, 20)];
        _numLabel.font = font(14);
        _numLabel.textColor = SFM51;
        _numLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _numLabel;
}

-(UILabel *)dateLabel
{
    if (_dateLabel == nil) {
        _dateLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 60, WIDTH - 40, 20)];
        _dateLabel.font = font(14);
        _dateLabel.textColor = SFM51;
        _dateLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _dateLabel;
}

-(UILabel *)timeLabel
{
    if (_timeLabel == nil) {
        _timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 85, WIDTH - 40, 20)];
        _timeLabel.font = font(14);
        _timeLabel.textColor = SFM51;
        _timeLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _timeLabel;
}


-(void)send{
    self.nameLabel.text = [NSString stringWithFormat:@"经营者：%@",@"张三"];
    self.numLabel.text = [NSString stringWithFormat:@"营业执照号码：%@",@"23232323525645"];
    self.dateLabel.text = @"营业执照有效期";
    self.timeLabel.attributedText = [NSMutableAttributedString headStr:@"从2018-10-9 至" AndMiddleStr:@"2019-2-10" AndFootStr:@"到期" AndFont:font(14) AndTextColor:[UIColor redColor]];
}

-(void)sendMyLicenceModel:(MyLicenceModel *)model
{
    self.nameLabel.text = [NSString stringWithFormat:@"经营者：%@",model.customername];
    self.numLabel.text = [NSString stringWithFormat:@"营业执照号码：%@",model.vcorplicensecode];
    self.dateLabel.text = @"营业执照有效期：";
    self.timeLabel.attributedText = [NSMutableAttributedString headStr:[NSString stringWithFormat:@"从 %@ 至",model.licensestartdate] AndMiddleStr:[NSString stringWithFormat:@" %@",model.licenseenddate] AndFootStr:@" 到期" AndFont:font(14) AndTextColor:[UIColor redColor]];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
